package notepad;

public class Page {
	private String title;
	private String text = "";
	
	@Override
	public String toString() {
		return "Page [title=" + title + ", text=" + text + "]";
	}

	public Page(String title) {
		if (title == null) {
			System.out.println("Wrong title format!");
		}
		else
			this.title = title;
	}

	protected void addText(final String addedText) {
		if (addedText != null) {
			text = text + "\n" + addedText;
		}
		else {
			System.out.println("Wrong text input!");
		}
		
	}

	protected void deleteText() {
		text = "";
	}

	protected String getPageInfo() {
		return title + "\n\n" + text;
	}
	
	public boolean equals(Object obj){
		if (obj != null && obj instanceof Page) {
			return ((Page)obj).title.equals(this.title);
		}else
			return false;
	}
// comment
}
